package br.edu.ufcg.lsd.wbis.ui.client.ui.loggedin.admin;


import com.gwtext.client.core.EventObject;
import com.gwtext.client.widgets.Button;
import com.gwtext.client.widgets.Toolbar;
import com.gwtext.client.widgets.ToolbarButton;
import com.gwtext.client.widgets.event.ButtonListenerAdapter;

public class DataMovingToolBar extends Toolbar {

	public static class PreviousDataListener extends ButtonListenerAdapter {

		private final InfoShower tab;

		public PreviousDataListener(InfoShower tab) {
			this.tab = tab;
		}

		/**
		 * {@inheritDoc}
		 */
		@Override
		public void onClick(Button button, EventObject e) {
			this.tab.showPreviousData();
		}

	}

	public static class NextDataListener extends ButtonListenerAdapter {

		private final InfoShower tab;

		public NextDataListener(InfoShower tab) {
			this.tab = tab;
		}

		/**
		 * {@inheritDoc}
		 */
		@Override
		public void onClick(Button button, EventObject e) {
			this.tab.showNextData();
		}

	}

	public DataMovingToolBar(PreviousDataListener previousListener, NextDataListener nextListener) {

		this.addButton(new ToolbarButton("<< Previous", previousListener));
		this.addFill();
		this.addButton(new ToolbarButton("Next >>", nextListener));
	}
}
